package com.cqw.controller;

import com.cqw.utils.QRCodeUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;

/**
 * @Author: caoqingwen
 * @CreateTime: 2021-04-14 14:30
 * @Description:
 */
@RestController
@RequestMapping("/qr")
public class QRController {


    @PostMapping("/createQR")
    public void createQR(HttpServletResponse response) {
        try {
            ServletOutputStream outputStream = response.getOutputStream();
            QRCodeUtil.encode("http://www.baidu.com", "C:\\Users\\caoqingwen\\Pictures\\2032965.jpg", outputStream, true);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


}
